<section class="content-header">
  <h1>
    Users
    <small>{{ ctrl.users.length }} users</small>
  </h1>
  <ol class="breadcrumb">
    <li><a ui-sref="manage"><i class="fa fa-wrench"></i> Manage</a></li>
    <li class="active">Users</li>
  </ol>
</section>

<section class="content">
  <div class="box box-primary">
    <div class="box-header with-border">
      <h3 class="box-title">All Users</h3>
    </div>
    <div class="box-body no-padding">
      <div class="table-responsive">
        <table class="table table-hover table-striped">
          <tbody>
          <tr>
            <th>Nickname (Username)</th>
            <th style="width:190px">Roles</th>
            <th style="width:130px">Create At</th>
            <th style="width:90px">Real Name</th>
            <th style="width:100px">Department</th>
            <th style="width:80px">Grade</th>
            <th style="width:100px">Operations</th>
          </tr>
          <tr ng-repeat="user in ctrl.users">
            <td><a href="javascript:;" ng-click="ctrl.showUserDetail(user)">{{ user.profile.nickname }} ({{ user.username }})</a> <span data-balloon="{{ user.disableReason }}" ng-show="user.disabled" style="color:#FFF">(已禁用)</span></td>
            <td>{{ user.roles.join(', ') }}</td>
            <td><span data-balloon="{{ user.createdAt | date: 'yyyy-MM-dd (EEE) HH:mm:ss Z' }}">{{ user.createdAt | amCalendar }}</span></td>
            <td>{{ user.profile.name }}</td>
            <td>{{ user.profile.department }}</td>
            <td>{{ user.profile.grade }}</td>
            <td><a href="javascript:;" ng-click="ctrl.doResetPassword(user)">重设密码</a></td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</section>
